let listA = [4, 1, 8, 4, 5], listB = [5, 0, 1, 8, 4, 5]
function ListNode(val) {
    this.val = val;
    this.next = null;
}
function a(list) {
    let head = new ListNode(0)
    let cur = head
    for (let i = 0; i < list.length; i++) {
        cur.next = new ListNode(list[i])
        cur = cur.next
    }
    return head.next
}
var getIntersectionNode = function (headA, headB) {
    let left = headA
    let right = headB
    while (left !== right) {
        left = left ? left.next : headB
        right = right ? right.next : headA
    }
    return left
};